package error;

import java.util.Random;

import org.activiti.engine.delegate.BpmnError;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.apache.log4j.Logger;

public abstract class Activity implements JavaDelegate {
	private static Logger logger = Logger.getLogger(Activity.class);

	@Override
	public void execute(DelegateExecution arg0) throws Exception {
		try {
			arg0.setVariable("transmitTo", "");
			logger.info(this.getClass().getName());
			Random rnd = new Random();
			if (rnd.nextBoolean()) {
				logger.info("Error");
				throw (new Exception("Error"));
			}
		} catch (Exception e) {
			logger.info("Error occured but i not writing that error");
			throw(new BpmnError("123",e.getMessage()));
		}
	}

}